/*
 * RemoteTableTaskEvent.java
 * 
 * Written by Joseph Bowbeer and released to the public domain,
 * as explained at http://creativecommons.org/licenses/publicdomain
 */

package jozart.remotetable;

import java.util.EventObject;

import jozart.swingutils.SwingWorker;

/**
 * RemoteTableTaskEvent is used to notify listeners
 * when a task begins or ends.
 *
 * @author  Joseph Bowbeer
 * @version 2.0
 */
public class RemoteTableTaskEvent extends EventObject {

    /** Specifies connect task. */
    public static final int CONNECT    = 0;

    /** Specifies disconnect task. */
    public static final int DISCONNECT = 1;

    /** Specifies update task. */
    public static final int UPDATE     = 2;

    private final int type;
    private final SwingWorker<?> task;

    /**
     * Creates event with specified source, type, and future result.
     * <p>
     * The <tt>type</tt> should be one of: CONNECT, DISCONNECT, UPDATE.
     */
    public RemoteTableTaskEvent(Object source, int type, SwingWorker<?> task) {
        super(source);
        this.type = type;
        this.task = task;
    }

    /** Returns type. */
    public int getType() {
        return type;
    }

    /** Returns task. */
    public SwingWorker<?> getTask() {
        return task;
    }
}
